<?php
/**
 * 用户 model 类
 *
 * @author <judasnow@gmail.com>
 */
require_once( APPPATH . 'models/base_model.php' );

class User_model extends Base_model{
	private $_table_name;
	public function __construct(){
		$this->_table_name = 'user';
		parent::__construct( $this->_table_name );
	}
	public function get_user_nick_by_id( $user_id ){
		 $this->db->where( 'user_id' , $user_id );
		 $this->db->select( 'nick' );
		 $q = $this->db->get( 'user' );
		 if( $q->num_rows() > 0 ){
			 $res = $q->result_array();
			 return $res[0]['nick'];
		 }else{
			 return '[该用户已注销]';
			 //throw new Exception( '该用户不存在' );
		 }
	} 
}
